from langchain import hub
from langchain_community.llms import OpenAI,Tongyi
from langchain.agents import AgentExecutor, create_react_agent
from langchain.chat_models import  ChatOpenAI
from langchain_community.chat_models import ChatTongyi
import selftool


import os
os.environ["OPENAI_API_KEY"] = "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"
os.environ["DASHSCOPE_API_KEY"] = "sk-53b4fbc8f87b4362b110e47e5bbf9b22"

prompt = hub.pull("hwchase17/react")
model = ChatTongyi()
tools = [selftool.weather_tool]

agent = create_react_agent(model, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools,verbose=True)
print(agent_executor.invoke({
                    "input": "北京天气",
                }))






